package erfgame.core.world.terrain.async;

import erfgame.core.dao.ObjectDAO;

public class SynchronizingObjectDAOProxy<KeyType, ObjectType> implements
		ObjectDAO<KeyType, ObjectType> {
	
	private ObjectDAO<KeyType, ObjectType> proxied;
	
	// TODO : key-specific synchronization
	
	public SynchronizingObjectDAOProxy( ObjectDAO<KeyType, ObjectType> proxied ) {
		this.proxied = proxied;
	}

	public synchronized boolean containsObject(KeyType key) {
		return proxied.containsObject(key);
	}

	public synchronized boolean removeObject(KeyType key) {
		return proxied.removeObject(key);
	}

	public synchronized ObjectType retrieveObject(KeyType key) {
		return proxied.retrieveObject(key);
	}

	public synchronized void storeObject(KeyType key, ObjectType object) {
		proxied.storeObject(key, object);
	}
}
